const dbServer = require('../dao/dbSever')
const db = require('../config/db')
//引入发送邮箱方法
const emailServer = require('../dao/emailServer')
//注册页面服务
const signup = require('../server/signup')
const signin = require('../server/signin')
//搜索
const search = require('../server/search')
//用户详情
const userDetail = require('../server/userDetail')
//好友操作
const friend = require('../server/friend')
//首页
const home = require('../server/index')

const chat = require('../server/chat')
module.exports = (app) => {

    //注册用户
    app.post('/signup/add', (req, res) => {



        signin.buildUser(req, res)
    })
    //是否注册
    app.post('/signup/isSignup', (req, res) => {
        signup.isSignUp(req, res)
    })
    //登录
    app.post('/signin/signIn', (req, res) => {


        signin.signIn(req, res)
    })
    // 用户搜索
    app.post('/search/User', (req, res) => {


        search.searchUser(req, res)
    })
    // 是否为好友
    app.post('/search/isFriend', (req, res) => {


        search.isFriend(req, res)
    })
    // 群搜索
    app.post('/search/searchGroup', (req, res) => {


        search.searchGroup(req, res)
    })
    // 判断是否在群里
    app.post('/search/isInGroup', (req, res) => {


        search.isInGroup(req, res)
    })

    //用户详情 
    app.post('/userDetail/userDeta', (req, res) => {


        userDetail.userDeta(req, res)
    })
    //用户信息修改 
    app.post('/userDetail/userUpdate', (req, res) => {


        userDetail.userUpdate(req, res)
    })
    //好友昵称修改 
    app.post('/userDetail/friendMarkName', (req, res) => {


        userDetail.friendMarkName(req, res)
    })
    //获取好友昵称
    app.post('/userDetail/GetfriendMarkName', (req, res) => {


        userDetail.GetfriendMarkName(req, res)
    })

    //申请好友
    app.post('/friend/applyFriend', (req, res) => {
        friend.applyFriend(req, res)
    })
    //同意添加好友
    app.post('/friend/updateFriendState', (req, res) => {
        friend.updateFriendState(req, res)
    })
    //删除好友
    app.post('/friend/deleteFriend', (req, res) => {
        friend.deleteFriend(req, res)
    })
    //根据要求获取用户列表
    app.post('/home/getUsers', (req, res) => {
        home.getUsers(req, res)
    })
    //获取一对一消息  getOneMsg
    app.post('/home/getOneMsg', (req, res) => {


        home.getOneMsg(req, res)
    })
    //汇总一对一消息未读数

    app.post('/home/unrearMsg', (req, res) => {
        home.unrearMsg(req, res)
    })

    //一对一消息状态修改
    app.post('/home/updateMsg', (req, res) => {
        home.updateMsg(req, res)
    })

    //按要求获取群列表
    app.post('/home/getGroup', (req, res) => {
        home.getGroup(req, res)
    })
    //获取群最后一条消息

    app.post('/home/getOneMsg', (req, res) => {
        home.getOneMsg(req, res)
    })

    //群消息状态修改
    app.post('/home/updateGroupMsg', (req, res) => {
        home.updateGroupMsg(req, res)
    })

    //分页获取一对一聊天数据
    app.post('/chat/msg', (req, res) => {
        chat.msg(req, res)
    })
    //新建群
    app.post('/home/createGroup', (req, res) => {
        home.createGroup(req, res)
    })

}